.calculator-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #e8e8e8;
  color: #000;
  overflow: hidden;
}

// 显示屏区域
.display-area {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  padding: 40rpx 50rpx;
  position: relative;
  min-height: 360rpx;
  background: #e8e8e8;
}

// 正常显示内容
.display-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

// 公式显示区
.formula-section {
  flex: 0.4;
  display: flex;
  align-items: flex-end;
  margin-bottom: 20rpx;
}

// 公式显示
.formula-display {
  font-size: 56rpx;
  color: rgba(0, 0, 0, 0.4);
  text-align: right;
  width: 100%;
  opacity: 0.6;
  transition: all 0.3s ease;
  font-weight: 300;
  min-height: 60rpx;

  &.visible {
    opacity: 1;
    color: rgba(0, 0, 0, 0.8);
    font-weight: 400;
  }
}

// 结果显示区
.result-section {
  flex: 0.6;
  display: flex;
  align-items: center;
  margin-bottom: 40rpx;
}

// 结果显示
.result-display {
  font-size: 36rpx;
  font-weight: 300;
  text-align: right;
  color: rgba(0, 0, 0, 0.3);
  word-break: break-all;
  line-height: 1;
  width: 100%;
  transition: all 0.3s ease;
  opacity: 0;

  &.visible {
    opacity: 1;
    color: #2d5a5a;
    font-weight: 400;
  }

  &.small {
    font-size: 32rpx;
  }
}

// 右侧按钮组（并排显示）
.display-buttons {
  position: absolute;
  right: 0;
  bottom: 20rpx;
  display: flex;
  flex-direction: row;
  gap: 12rpx;
}

.display-btn {
  width: 64rpx;
  height: 64rpx;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;

  &:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.15);
  }
}

// 历史记录在显示区域内
.history-in-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24rpx;
  padding: 30rpx;
  margin: 10rpx 0;
  box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
}

.history-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24rpx;
  padding-bottom: 16rpx;
  border-bottom: 1rpx solid rgba(0, 0, 0, 0.06);
}

.history-title-inline {
  font-size: 30rpx;
  font-weight: 500;
  color: #333;
}

.close-history {
  width: 56rpx;
  height: 56rpx;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;

  &:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.08);
  }
}

.history-list-inline {
  flex: 1;
  max-height: 320rpx;
}

.history-item-inline {
  margin-bottom: 16rpx;
  transition: transform 0.2s ease;

  &:active {
    transform: scale(0.98);
  }

  &:last-child {
    margin-bottom: 0;
  }
}

.history-card {
  background: #fff;
  border-radius: 16rpx;
  padding: 20rpx 24rpx;
  box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
  border: 1rpx solid rgba(0, 0, 0, 0.04);
}

.history-expression-inline {
  font-size: 26rpx;
  color: #888;
  margin-bottom: 8rpx;
  text-align: right;
  font-weight: 300;
}

.history-result-inline {
  font-size: 32rpx;
  font-weight: 500;
  color: #2d5a5a;
  text-align: right;
  margin-bottom: 8rpx;
}

.history-time-inline {
  font-size: 22rpx;
  color: #bbb;
  text-align: right;
  font-weight: 300;
}

.history-empty-inline {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20rpx;
}

.empty-text-inline {
  color: #999;
  font-size: 26rpx;
  font-weight: 300;
}

// 按钮区域
.buttons-area {
  flex: 1;
  background: #f0f0f0;
  padding: 30rpx 20rpx 60rpx;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  border-radius: 40rpx 40rpx 0 0;
}

.button-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16rpx;

  &:last-child {
    margin-bottom: 0;
  }
}

.button {
  width: 140rpx;
  height: 140rpx;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42rpx;
  font-weight: 400;
  transition: all 0.15s ease;
  user-select: none;
  position: relative;
  overflow: hidden;
  margin: 0 8rpx;
  background: #fff;
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);

  &:first-child {
    margin-left: 0;
  }

  &:last-child {
    margin-right: 0;
  }

  // 数字按钮样式 - 深蓝绿色文字
  &.number {
    color: #2d5a5a;

    &:active {
      transform: scale(0.94);
      background: #f8f8f8;
      box-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.1);
    }
  }

  // 功能按钮样式 - 深灰色文字
  &.function {
    color: #666;

    &:active {
      transform: scale(0.94);
      background: #f8f8f8;
      box-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.1);
    }
  }

  // 操作符按钮样式 - 深棕色文字
  &.operator {
    color: #8b7355;

    &:active {
      transform: scale(0.94);
      background: #f8f8f8;
      box-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.1);
    }
  }

  // 清除按钮样式 - 红色文字
  &.clear {
    color: #d32f2f;

    &:active {
      transform: scale(0.94);
      background: #f8f8f8;
      box-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.1);
    }
  }

  // 等号按钮样式 - 深棕色背景，白色文字
  &.equals {
    background: #8b7355;
    color: #fff;
    box-shadow: 0 2rpx 12rpx rgba(139, 115, 85, 0.3);

    &:active {
      transform: scale(0.94);
      background: #6d5a42;
      box-shadow: 0 1rpx 6rpx rgba(139, 115, 85, 0.4);
    }
  }

  // 按钮点击波纹效果
  &::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
  }

  &:active::before {
    width: 200rpx;
    height: 200rpx;
  }
}

// 历史记录弹窗样式
.history-popup {
  height: 100%;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
}

.history-header {
  padding: 60rpx 40rpx 30rpx;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;

  &::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20rpx;
    background: #f8f9fa;
    border-radius: 20rpx 20rpx 0 0;
  }
}

.history-title {
  font-size: 44rpx;
  font-weight: 600;
}

.history-actions {
  display: flex;
  gap: 20rpx;
}

.history-list {
  flex: 1;
  padding: 30rpx 20rpx;
  background: #f8f9fa;
}

.history-item {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32rpx 28rpx;
  margin-bottom: 16rpx;
  border-radius: 20rpx;
  box-shadow: 0 2rpx 16rpx rgba(0, 0, 0, 0.04);
  border: 1rpx solid rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;

  &:active {
    transform: scale(0.98);
    box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
  }

  &:last-child {
    margin-bottom: 0;
  }
}

.history-content {
  flex: 1;
  color: #000;
}

.history-expression {
  font-size: 30rpx;
  color: #666;
  margin-bottom: 8rpx;
  font-weight: 300;
  line-height: 1.3;
}

.history-result {
  font-size: 36rpx;
  font-weight: 600;
  color: #2d5a5a;
  margin-bottom: 8rpx;
  line-height: 1.2;
}

.history-time {
  font-size: 24rpx;
  color: #999;
  font-weight: 300;
}

.history-delete {
  width: 80rpx;
  height: 80rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  margin-left: 20rpx;

  &:active {
    background-color: rgba(255, 71, 87, 0.1);
    transform: scale(0.9);
  }
}

.history-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  padding: 80rpx 40rpx;
}

.empty-icon {
  margin-bottom: 32rpx;
  opacity: 0.3;
}

.empty-title {
  font-size: 36rpx;
  color: #666;
  font-weight: 500;
  margin-bottom: 16rpx;
  text-align: center;
}

.empty-desc {
  font-size: 28rpx;
  color: #999;
  font-weight: 300;
  text-align: center;
  line-height: 1.4;
}

// 响应式适配
@media screen and (max-width: 750rpx) {
  .formula-display {
    font-size: 48rpx;
    min-height: 52rpx;
  }

  .result-display {
    font-size: 32rpx;

    &.small {
      font-size: 28rpx;
    }
  }

  .button {
    width: 120rpx;
    height: 120rpx;
    font-size: 38rpx;
  }

  .display-btn {
    width: 56rpx;
    height: 56rpx;
  }
}

// 大屏适配
@media screen and (min-width: 1200rpx) {
  .calculator-container {
    max-width: 800rpx;
    margin: 0 auto;
    border-radius: 40rpx;
    box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.1);
  }
}

// 暗色模式适配
@media (prefers-color-scheme: dark) {
  .calculator-container {
    background: #2d2d2d;
    color: #fff;
  }

  .display-area {
    background: #2d2d2d;
  }

  .formula-display {
    color: rgba(255, 255, 255, 0.4);

    &.visible {
      color: rgba(255, 255, 255, 0.8);
      font-weight: 400;
    }
  }

  .result-display {
    color: rgba(255, 255, 255, 0.3);

    &.visible {
      color: #4caf50;
      font-weight: 400;
    }
  }

  .display-btn {
    background: rgba(255, 255, 255, 0.08);

    &:active {
      background: rgba(255, 255, 255, 0.15);
    }
  }

  .history-in-display {
    background: rgba(44, 44, 44, 0.95);
  }

  .history-header-inline {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .history-title-inline {
    color: #fff;
  }

  .close-history {
    background: rgba(255, 255, 255, 0.05);

    &:active {
      background: rgba(255, 255, 255, 0.1);
    }
  }

  .history-card {
    background: #3d3d3d;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .history-expression-inline {
    color: #aaa;
  }

  .history-result-inline {
    color: #4caf50;
  }

  .history-time-inline {
    color: #777;
  }

  .empty-text-inline {
    color: #888;
  }

  .buttons-area {
    background: #3d3d3d;
  }

  .button {
    background: #4d4d4d;
    box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);

    &.number {
      color: #4caf50;
    }

    &.function {
      color: #bbb;
    }

    &.operator {
      color: #ff9800;
    }

    &.clear {
      color: #f44336;
    }

    &:active {
      background: #5d5d5d;
    }

    &::before {
      background: rgba(255, 255, 255, 0.1);
    }
  }

  .history-popup {
    background: #2d2d2d;
    color: #fff;
  }

  .history-header {
    background: linear-gradient(135deg, #434343 0%, #2d2d2d 100%);

    &::after {
      background: #2d2d2d;
    }
  }

  .history-list {
    background: #2d2d2d;
  }

  .history-item {
    background: #3d3d3d;
    border-color: rgba(255, 255, 255, 0.05);

    &:active {
      background-color: #4d4d4d;
    }
  }

  .history-content {
    color: #fff;
  }

  .history-expression {
    color: #aaa;
  }

  .history-result {
    color: #4caf50;
  }

  .history-time {
    color: #888;
  }

  .history-empty {
    background: #2d2d2d;
  }

  .empty-title {
    color: #aaa;
  }

  .empty-desc {
    color: #888;
  }
}
